package com.xingongchang.baolebei.activity;

import org.json.JSONException;
import org.json.JSONObject;

import android.app.Activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.TextView;

import com.external.androidquery.callback.AjaxStatus;
import com.insthub.BeeFramework.model.BusinessResponse;
import com.xingongchang.baolebei.BaolebeiAppConst;
import com.xingongchang.baolebei.R;

public class LogisticsActivity extends Activity implements BusinessResponse{
	private WebView logistic_web;
	ImageView imageView;
	String name, id;
	ProgressDialog dialog;
    TextView top_logistic_text;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.logisticsweb);
		imageView = (ImageView) findViewById(R.id.top_logistic_back);
		imageView.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				finish();
			}
		});
		top_logistic_text=(TextView) findViewById(R.id.top_logistic_text);
		logistic_web = (WebView) findViewById(R.id.logistic_web);
		name = getIntent().getStringExtra("shipping_name");
		id = getIntent().getStringExtra("invoice_no");
		WebSettings webSettings = logistic_web.getSettings();
		webSettings.setJavaScriptEnabled(true);
		if (logistic_web != null) {
			logistic_web.setWebViewClient(new WebViewClient() {
				@Override
				public void onPageFinished(WebView view, String url) {
					dialog.dismiss();
				}
			});
			loadUrl(BaolebeiAppConst.DOMAIN+"/transInfo.html?type=" + name
					+ "&postid=" + id);
		}

	}

	public void loadUrl(String url) {
		if (logistic_web != null) {
			logistic_web.loadUrl(url);
			dialog = ProgressDialog.show(this, null, "页面加载中，请稍后..");
			logistic_web.reload();
		}
	}

	@Override
	public void OnMessageResponse(String url, JSONObject jo, AjaxStatus status)
			throws JSONException {
		
	}

}
